package com.jishuo.nontax.bean.vo;

import com.jishuo.nontax.bean.bank.Unit;
import com.jishuo.nontax.bean.bank.UnitXml;
import com.jishuo.nontax.bean.message.SetUnitDTO;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;


/**
 * 单位信息
 *
 * @author hlp
 * @email 1459875748@qq.com
 * @date 2023-02-02 10:13:13
 */
@Data
public class UnitVO implements Serializable {
    private static final long serialVersionUID = 1L;

    //唯一标识号
    private Long unitid;
    //行政区划ID
    private Long cantonid;
    //单位（部门）编码
    private String unitcode;
    //单位（部门）名称
    private String unitname;
    //是否可用
    private Integer isenable;
    //操作时间
    private String writetime;

    private String id;

    private String cantoncode;
    private String cantonname;

    public UnitVO() {
    }

    public UnitVO(SetUnitDTO bean) {

        if (bean.getUnitid() != null) {
            this.unitid = Long.valueOf(bean.getUnitid());
        }
        if (bean.getCantonid() != null) {
            this.cantonid = Long.valueOf(bean.getCantonid());
        }
        this.unitcode = bean.getUnitcode();
        this.unitname = bean.getUnitname();
    }


    public UnitXml findUnit() {
        UnitXml xml = new UnitXml();
        ArrayList<Unit> list = new ArrayList<>();
        Unit unit = new Unit();
        unit.setCantonid(String.valueOf(this.cantonid));
        unit.setUnitcode(this.unitcode);
        unit.setUnitname(this.unitname);
        unit.setUnitid(String.valueOf(this.unitid));
        list.add(unit);
        xml.setUnit(list);

        return xml;
    }
}
